﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using cbelo.Models;
using cbelo.Helpers;

namespace cbelo.Controllers
{
    public class PanoController : Controller
    {
        //
        // GET: /MDF/

        panoRepositorio panoRepositorio = new panoRepositorio();

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult PanoPrato()
        {
            var id = 1;
            var page = 0;

            var alldataPano = panoRepositorio.Select();
            var paginateddataPano = new NonPaginatedList<panoprato>(alldataPano);

            ViewData["PanoPrato"] = paginateddataPano;

            var title = panoRepositorio.GetGroupName(id);
            ViewData["title"] = title;

            var alldata = panoRepositorio.SelectGroup(id);
            var paginateddata = new PaginatedListPages<panoproduct>(alldata, page, HelpersConstants.MaxPageSize);

            return View(paginateddata);
        }

        public ActionResult PanoPratoDetails(int id, int page)
        {
            var alldataPano = panoRepositorio.Select();
            var paginateddataPano = new NonPaginatedList<panoprato>(alldataPano);

            ViewData["PanoPrato"] = paginateddataPano;

            var title = panoRepositorio.GetGroupName(id);
            ViewData["title"] = title;

            var alldata = panoRepositorio.SelectGroup(id);
            var paginateddata = new PaginatedListPages<panoproduct>(alldata, page, HelpersConstants.MaxPageSize);

            return View(paginateddata);
        }
    }
}
